<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        .box {
            width: 300px;
            height: 300px;
            background-color: #f00;
        }

        .son {
            width: 100px;
            height: 100px;
            background-color: #0f0;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="son"></div>
    </div>

    <script>

        /*
            事件冒泡： 当某个元素的事件触发后，会依次调用它所有父级的同名事件，直到document
        */
        document.querySelector('.son').onclick = function (e) {

            console.log('son被点了')
            console.log('target', e.target)
            console.log('currentTarget',e.currentTarget)
        }

        document.querySelector('.box').onclick = function (e) {

            console.log('box被点了')
            console.log('target', e.target)
            console.log('currentTarget',e.currentTarget)
        }

        document.body.onclick = function (e) {

            console.log('body被点了')
            console.log('target', e.target)
            console.log('currentTarget',e.currentTarget)
        }
    </script>
</body>
</html>